using UnityEngine;
using UnityEngine.UI;

public class PauseButton : MonoBehaviour
{
    public RhythmGameController gameController;
    Button button;

    private void Start()
    {
        button = GetComponent<Button>();
        button.onClick.AddListener(PauseOrPlayMusic);
    }

    void PauseOrPlayMusic()
    {
        gameController.isPauseState = !gameController.isPauseState;
        if( gameController.isPauseState )
        {
            gameController.PauseMusic();
        }
        else
        {
            gameController.PlayMusic();
        }
    }
}
